package com.yy.main.app.web.base;

import com.yy.kit.log.YYLogKits;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;


/**
 * <p>
 * 处理异常的控制器
 * </p>
 *
 * @author 杨阳
 * @since 2017年12月4日
 */
@Api(value = "错误Controller", description = "处理404、500等异常控制器")
@Controller()
@RequestMapping("/error")
public class ErrorController extends CommonController {

    @ApiOperation(value = "跳转到404页面", httpMethod = "GET")
    @RequestMapping(value = "/404", method = RequestMethod.GET)
    public ModelAndView notFoundUri() {
        YYLogKits.printException(this.getClass(), "/404");
        return super.goToPageByModelAndView("/error/404", null);
    }

    @ApiOperation(value = "跳转到500页面", httpMethod = "GET")
    @RequestMapping(value = "/500", method = RequestMethod.GET)
    public ModelAndView exceptionPage() {
        YYLogKits.printException(this.getClass(), "/500");
        return super.goToPageByModelAndView("error/500", null);
    }

}
